package com.java_base.loop;

public class ForDemo03 {
    public static void main(String[] args) {

        int sum = 0;
        // 奇数和
        for (int i = 1; i < 10; i++) {
            if (i % 2 == 1){
             sum += i;
            }
        }
        System.out.println(sum);

        System.out.println("---------------------------------");
        int sum1 = 0;
        for (int i = 1; i < 5; i += 2) {
            sum1 += i;
        }
        System.out.println(sum1);
    }
}
